﻿using Entity.Models.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace RepositorySys.Models
{
    /// <summary>
    /// 用户信息dto类
    /// 
    /// 作用：传输数据
    /// </summary>
    public class UserInfoDTO
    {
        /// <summary>
        /// id
        /// </summary>
        public string _Id { get; set; }
        /// <summary>
        /// 账号
        /// </summary>
        public string _account { get; set; }
        /// <summary>
        /// 用户昵称
        /// </summary>
        public string _userName { get; set; }
        /// <summary>
        /// 手机
        /// </summary>
        public string _phoneNum { get; set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        public string _email { get; set; }
        /// <summary>
        /// 部门id
        /// </summary>
        public string _eepartmentId { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public string _sex { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        public string _passWord { get; set; }
        /// <summary>
        /// 是否管理员
        /// </summary>
        public string _isAdmin { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public string _createTime { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public bool? _isDelete { get; set; }

        /// <summary>
        /// 删除时间
        /// </summary>
        public DateTime? _eeleteTime { get; set; }



        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userInfo"></param>
        public UserInfoDTO(UserInfo userInfo, DepartmentInfo departments)
        {
            _Id = userInfo.Id;
            _account = userInfo.Account;
            _userName = userInfo.UserName;
            _phoneNum = userInfo.PhoneNum;
            _email = userInfo.Email;
            _eepartmentId = departments != null? departments.DepartmentName:"";
            _sex = userInfo.Sex!=1 ? "女":"男";
            _isAdmin = userInfo.IsAdmin!=true ? "用户":"管理员";
            _createTime = userInfo.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
            _isDelete = userInfo.IsDelete;
        }

        public UserInfoDTO(string account, string passWord)
        {
            _account = account;
            _passWord = passWord;
        }
        public UserInfoDTO()
        {
           
        }
    }
}
